package com.peanut.baby.model;


import androidx.annotation.NonNull;

import com.google.gson.annotations.SerializedName;
import com.peanut.baby.mvp.calendar.CalUtil;
import com.peanut.devlibrary.util.StringUtil;

import java.io.Serializable;

/**
 * Created by anonymouslystudio on 2017/9/6.
 */

public class CalendarRecord implements Serializable,Comparable<CalendarRecord>{
    @SerializedName("userId")
    public int      userId;
    @SerializedName("logDate")
    public String   date;
    @SerializedName("logA")
    public String   dayima;
    @SerializedName("logC")
    public String   tiwen;
    @SerializedName("logB")
    public String   tongfang;
    @SerializedName("logD")
    public String   yesuan;
    @SerializedName("logE")
    public String   baidai;


    @Override
    public int compareTo(@NonNull CalendarRecord o) {
        if(StringUtil.isNullOrEmpty(date)){
            return -1;
        }
        if(StringUtil.isNullOrEmpty(o.date)){
            return 1;
        }

        int days = CalUtil.daysBetween(o.date,date);
        if(days == 0){
            return 0;
        }else if(days > 0){
            return 1;
        }else{
            return -1;
        }
    }

    @Override
    public String toString() {
        return "CalendarRecord{" +
                "userId=" + userId +
                ", date='" + date + '\'' +
                ", dayima='" + dayima + '\'' +
                ", tiwen='" + tiwen + '\'' +
                ", tongfang='" + tongfang + '\'' +
                ", yesuan='" + yesuan + '\'' +
                ", baidai='" + baidai + '\'' +
                '}';
    }
}
